<template>
  <div id="woa-detail">
  detail
  {{type}}
  {{id}}
  </div>
</template>

<script>

const TYPE_IS_EDIT = 'edit';
const TYPE_IS_ADD = 'add';

export default {
  data() {
    return {
      id: this.$route.params.id || '',
      type: this.$route.params.id ? TYPE_IS_EDIT : TYPE_IS_ADD,
    };
  },
  beforeRouteUpdate(to) {
    console.log('beforeRouteUpdate ', to);
    const id = to.params.id || '';
    if (id) {
      this.id = id;
      this.type = TYPE_IS_EDIT;
    } else {
      this.id = '';
      this.type = TYPE_IS_ADD;
    }
  },
  components: {
  },
  mounted() {
    console.log('woa detail');
  },
  methods: {
  },
};
</script>

<style>
</style>
